package com.cjc.myimageload;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;

import com.cjc.myimageload.adapter.Image;
import com.cjc.myimageload.adapter.ImageAdapter;
import com.cjc.myimageload.lib.ImageLoader;

public class MainActivity extends Activity {
	private ListView mLv_list;
	private ImageAdapter mAdapter;
	private List<Image> mDatas;
	private ImageLoader mImageLoader;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		mImageLoader = new ImageLoader(this);
		mLv_list = (ListView) this.findViewById(R.id.lv_list);
		mDatas = getDatas();
		System.out.println("----------mDatas.size():" + mDatas.size());
		mAdapter = new ImageAdapter(this, mDatas, mImageLoader);
		mLv_list.setAdapter(mAdapter);
	}

	private List<Image> getDatas() {
		List<Image> mDatas = new ArrayList<Image>();
		Image iv1 = new Image();
		iv1.imagePic = "https://www.baidu.com/img/baidu_jgylogo3.gif?v=44282647.jpg";
		iv1.imageTime = "2015-2-3 10:22:45";
		mDatas.add(iv1);
		Image iv2 = new Image();
		iv2.imagePic = "https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superplus/img/logo_white_ee663702.png";
		iv2.imageTime = "2015-2-3 10:22:45";
		mDatas.add(iv2);
		Image iv3 = new Image();
		iv3.imagePic = "http://fanyi.baidu.com/static/i18n/zh/widget/translate/head/logo/logo_16ea8bb7.png";
		iv3.imageTime = "2015-2-3 10:22:45";
		mDatas.add(iv3);
		Image iv4 = new Image();
		iv4.imagePic = "http://b.hiphotos.bdimg.com/album/h%3D370%3Bq%3D90/sign=efd12302acaf2eddcbf14feebd2b70d4/42a98226cffc1e17135ad1354a90f603728de9c9.jpg";
		iv4.imageTime = "2015-2-3 10:22:45";
		mDatas.add(iv4);
		Image iv5 = new Image();
		iv5.imagePic = "http://www.moyilu.cn/xinwen2006/lys-17.jpg";
		iv5.imageTime = "2015-2-3 10:22:45";
		mDatas.add(iv5);
		Image iv6 = new Image();
		iv6.imagePic = "http://d.img.youboy.com/20113/12/14/g1/g1_12252420s.jpg";
		iv6.imageTime = "2015-2-3 10:22:45";
		mDatas.add(iv6);
		return mDatas;
	}

}
